<?php
class LinksModel extends Model{

	protected $autoCheckFields=false;
	
	public function add_link($data) {
		$Links = D("Links"); // 实例化User对象

			if ($Links->data($data)->add()) {
				return  true;
			}else {
				
				Log::write($Links->getLastSql());
				return  false;
			}

		
	}
	
	public function del($id) {
		
		if (D( 'Links' )->where(array('link_id'=>$id))->delete()) {
			return  true;
		}else {
			return  false;
		}
		
	}
	
	public function update($param) {
	

		print_array($data);//die();
		
	}
	

	public function detail($id) {
		
		$link_list = D( 'Links' )->where(array('link_id'=>$id))->find();
		
		return $link_list;
	}
	
	
	
	public function get_links_list($limit=10,$order= 'link_sort desc  , link_id asc',$tag=1) {
	
		$link_list = D( 'Links' )->where($tag)->order ($order )->limit ( $limit )->select ();
		
		return $link_list;
	}
	
	
	
}